class Person {
    constructor() {
    }
    private _name: string;

    public get name() {
        return this._name;
    }

    public set name(name: string) {
        this._name = name;
    }
}

let person = new Person();

// person._name = "apple";  // 无法访问到_name变量

person.name = "apple";

console.log(person.name);  // 输出 apple



{//其他的

    private static _instance: BrowserPlatform = new BrowserPlatform();

    // //获得实例对象
    // public static getInstance(): BrowserPlatform {

    //     public get name() {
    //         return this._name;
    //     }

    //     public set name(name: string) {
    //         this._name = name;
    //     }
    // }  
    
    public static get Instance() {
        return this._instance;
    }

    public static set Instance(_instance: BrowserPlatform) {
        this._instance = _instance;
    }

}

